Skip to content

Fix #7757: Do auto-parameter-untupling also for overloaded methods #7766

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Dec 18, 2019

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Dec 15, 2019

The case where a lambda is passed to a single method is handled in typedFunction.
But overloading resolution failed before getting there.

The case where a lambda is passed to a single method is handled in `typedFunction`.
But overloading resolution failed before getting there.
Copy link
Contributor

@anatoliykmetyuk anatoliykmetyuk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't work if you specify the types of the params of the lambda explicitly:

trait Foo
  def g(f: ((Int, Int)) => Int): Int = 1
  def g(f: ((Int, Int)) => (Int, Int)): String = "2"

@main def Test =
  val m: Foo = ???
  m.g((x: Int, b: Int) => (x, x))
-- [E134] Type Mismatch Error: /Users/kmetiuk/Projects/scala3/pg/sandbox/iss3.scala:7:4
7 |  m.g((x: Int, b: Int) => (x, x))
  |  ^^^
  |  None of the overloaded alternatives of method g in trait Foo with types
  |   (f: ((Int, Int)) => (Int, Int)): String
  |   (f: ((Int, Int)) => Int): Int
  |  match arguments ((Int, Int) => (Int, Int))
1 error found

@odersky
Copy link
Contributor Author

odersky commented Dec 17, 2019

@anatoliykmetyuk It's too late to fix this now (the fix looks quite a lot more complicated). Can you make an issue so that we come back to this? But I think the current fix should be merged since it is tripping people up.

@odersky odersky assigned anatoliykmetyuk and unassigned odersky Dec 17, 2019
@odersky
Copy link
Contributor Author

odersky commented Dec 18, 2019

I managed to fix the issue after all.

@anatoliykmetyuk anatoliykmetyuk merged commit 0382f6b into scala:master Dec 18, 2019
@anatoliykmetyuk anatoliykmetyuk deleted the fix-#7757 branch December 18, 2019 10:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants